import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import '../../../app_files.dart';

import 'action.dart';
import 'state.dart';

Widget buildView(InstallTypeEditViewState state, Dispatch dispatch,
    ViewService viewService) {
  return Scaffold(
    backgroundColor: Colors.white,
    appBar: myAppBar(viewService.context, title: '安装类型'),
    body: Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Container(
          height: 50,
          padding: EdgeInsets.only(left: 12),
          decoration: BoxDecoration(
              border:
                  Border(bottom: BorderSide(color: ThemeConfig.separeColor))),
          child: Row(
            children: [
              Container(
                width: 110,
                child: Row(
                  children: [
                    Text(
                      '选择安装类型:',
                      style: TextThemeConfig.Font15WithColor22,
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
        MyInkWellWidget(
          child: Container(
            padding: EdgeInsets.only(left: 20, right: 20),
            decoration: BoxDecoration(
                border:
                    Border(bottom: BorderSide(color: ThemeConfig.separeColor))),
            height: 44,
            child: Row(
              children: [
                Text(
                  '壁挂炉',
                ),
                Expanded(child: Container()),
                state.installType.contains('1')
                    ? Image.asset('images/cricle_select.png')
                    : Image.asset('images/circle.png')
              ],
            ),
          ),
          onTap: () => dispatch(InstallTypeEditViewActionCreator.onTap('1')),
        ),
        MyInkWellWidget(
          child: Container(
            padding: EdgeInsets.only(left: 20, right: 20),
            decoration: BoxDecoration(
                border:
                Border(bottom: BorderSide(color: ThemeConfig.separeColor))),
            height: 44,
            child: Row(
              children: [
                Text(
                  '热水器',
                ),
                Expanded(child: Container()),
                state.installType.contains('2')
                    ? Image.asset('images/cricle_select.png')
                    : Image.asset('images/circle.png')
              ],
            ),
          ),
          onTap: () => dispatch(InstallTypeEditViewActionCreator.onTap('2')),
        ),
        MyInkWellWidget(
          child: Container(
            padding: EdgeInsets.only(left: 20, right: 20),
            decoration: BoxDecoration(
                border:
                Border(bottom: BorderSide(color: ThemeConfig.separeColor))),
            height: 44,
            child: Row(
              children: [
                Text(
                  '灶具',
                ),
                Expanded(child: Container()),
                state.installType.contains('3')
                    ? Image.asset('images/cricle_select.png')
                    : Image.asset('images/circle.png')
              ],
            ),
          ),
          onTap: () => dispatch(InstallTypeEditViewActionCreator.onTap('3')),
        ),
    Container(
      margin: EdgeInsets.symmetric(horizontal: 15, vertical: 40),
      height: 50,
      decoration: BoxDecoration(
        color: ThemeConfig.mainColor,
        borderRadius: BorderRadius.all(Radius.circular(4)),
      ),
      child: InkWell(
        child: Align(
          child: Text(
            '保存',
            style: TextThemeConfig.Font16WithWhite,
          ),
        ),
        onTap: () => dispatch(InstallTypeEditViewActionCreator.onSubmit()),
      ),
    )
      ],
    ),
  );
}
